package com.woniuxy.cloud52.cinemaassembly.controller;


import com.woniuxy.cloud.ticket52.common.result.Result;
import com.woniuxy.cloud52.SeatAPI;
import com.woniuxy.cloud52.cinemaassembly.dao.SeatMapper;
import com.woniuxy.cloud52.cinemaassembly.model.Seat;
import com.woniuxy.cloud52.form.SeatForm;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * <p>
 * 座位表 前端控制器
 * </p>
 *
 * @author rc
 * @since 2021-05-06
 */
@RestController
@Slf4j
public class SeatController implements SeatAPI {

    @Autowired
    private SeatMapper seatMapper;

    @Override
    public Result doseat(SeatForm seatForm) {
        log.info("{}电影选座位{}",seatForm.getMcId(),seatForm.getNumber());
        Seat seat = new Seat();
        seat.setMcId(seatForm.getMcId()+"");
        seat.setNumber(seatForm.getNumber());
        seat.setStatus("已购买");
        seatMapper.addSeat(seat);
        return Result.success(seat.getSeatId());
    }
}

